import { IGraph } from './graph'

export interface IAreaCalculation {
  sum: Function
  prinfArea: Function
}

export class AreaCalculation implements IAreaCalculation {
  // 能够体现：依赖倒置原则
  constructor(public graph: IGraph) {}

  sum() {
    // 能够体现：开闭原则
    return this.graph.area()
  }

  prinfArea() {
    console.log(`area is ${this.sum()}`)
  }
}
